import httpRequest from "./base";
interface QueryDataDto {
  pageSize: number;
  pageNumber: number;
  recordDateStart: string;
  recordDateEnd: string;
}
interface ExportExcelDto {
  recordDateStart: string;
  recordDateEnd: string;
}
interface ErrorLianluDto {
  lianlu_code: string;
  lianlu_name: string;
  lianlu_start: string;
  lianlu_end: string;
  error_time_start: string;
  error_time_end: string;
  error_reason: string;
  plan_error: string;
  record_date: string;
}
// 获取全部链路信息
export function getErrorLianluListApi(params: QueryDataDto) {
  return httpRequest({
    url: "/errorLianlu",
    method: "get",
    params,
  });
}
// 获取日期分类的异常链路数量
export function getErrorLianluNumberApi() {
  return httpRequest({
    url: "/errorLianlu/lianluDataNumber",
    method: "get",
  });
}
// 创建异常链路信息
export function createErrorLianluApi(data: ErrorLianluDto) {
  return httpRequest({
    url: "/errorLianlu",
    method: "post",
    data,
  });
}
// 更新异常链路信息
export function updataErrorLianluApi(id: string, data: ErrorLianluDto) {
  return httpRequest({
    url: `/errorLianlu/${id}`,
    method: "put",
    data,
  });
}
// 删除异常链路信息
export function delErrorLianluListApi(id: string) {
  return httpRequest({
    url: `/errorLianlu/${id}`,
    method: "delete",
  });
}
// 导出链路信息
export function exportExcelErrorLianluApi(data: ExportExcelDto) {
  return httpRequest({
    url: "/errorLianlu/export",
    method: "post",
    data,
  });
}
// 导入异常链路信息文件
export function insetErrorLianluByFileApi(data: FormData) {
  return httpRequest({
    url: "/errorLianlu/errorLianluFile",
    method: "post",
    data,
    headers: {
      "Content-Type":
        "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
    },
  });
}
